package com.dmitriyp.movie.console.actions;

import static java.lang.System.out;

import java.util.List;

import com.dmitriyp.movie.console.AbstractUserAction;
import com.dmitriyp.movie.console.UserInputUtil;
import com.dmitriyp.movie.dao.IMovieManager;
import com.dmitriyp.movie.mapping.Movie;

public class UserFilterByStarAction extends AbstractUserAction {

    public UserFilterByStarAction(IMovieManager manager) {
        super(manager);
    }

    public void doAction() {
        out.println("Enter Star's name");
        String title = scanner.next();
        List<Movie> result = getManager().filterByStar(title);
        for (Movie movie : result) {
            out.println(movie + " - " + movie.getStars());
        }
        UserInputUtil.pressAnyKey();
    }

}
